<template>
  <div>
    <Appheader :parentToChild="ymname"></Appheader>
    <div class="guwenDetail" v-loading="loading">
      <div class="guwen_D_a flex">
        <p class="line"></p>
        <div>{{ymname}}</div>
      </div>
      <div class="guwen_D_b">
        <img :src="info.authorPhoto" alt />
        <div class="guwenD_detail">
          <div class="guwenD_detail_a">{{info.authorName}}</div>
          <div class="guwenD_detail_b" v-if="info.authorPosition">{{info.authorPosition}}</div>
          <div class="guwenD_detail_c" v-html="info.authorDetails"></div>
        </div>
      </div>
    </div>
    <div class="classfy_a">
      <div class="flex a_top">
        <div class="left_line flex">
          <p class="line"></p>精品课程
        </div>
      </div>
      <ul class="b_bottom" v-if="listarry">
        <li v-for="(list,index) in listarry" :key="index">
          <img :src="list.photo" alt @click="xkdetail(list.id)" />
          <div class="hidden b_bottom_a" @click="xkdetail(list.id)">{{list.title}}</div>
          <div class="b_bottom_c flex" @click="see_audio(list.videourl)">免费试听</div>
        </li>
      </ul>
      <div v-else class="tip2"><img src="../assets/none.png" alt=""></div>
    </div>
    <Appfooter></Appfooter>
    <el-dialog :visible.sync="dialogVisible" width="800px" title="免费试听" center>
      <div class="model_video">
        <video :src="vedio" autoplay controls v-if="vedio"></video>
        <span v-if="!vedio">该老师暂时没有免费试听课程</span>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import Appheader from "./header";
import Appfooter from "./footer";
import { ykAuthorinfo, ykAuthorteachercourse } from "../api/index.js";
export default {
  props: {},
  data() {
    return {
      id: "", //专家id
      loading: true,
      info: "",
      ymname: "",
      listarry: [],
      dialogVisible: false,
      vedio: ""
    };
  },
  computed: {},
  created() {
    this.ymname =
      this.$route.params.name || sessionStorage.getItem("school_name");
    sessionStorage.setItem("school_name", this.ymname);
  },
  mounted() {
    this.id = this.$route.params.id || sessionStorage.getItem("teacher_id");
    sessionStorage.setItem("teacher_id", this.id);
    this.post();
    this.postAudio();
  },
  watch: {},
  methods: {
    post() {
      let msg = {
        id: this.id
      };
      ykAuthorinfo(this.qs(msg))
        .then(res => {
          this.info = res.data.ykAuthor;
        })
        .catch(e => {});
      this.loading = false;
    },
    postAudio() {
      let msg = {
        id: this.id
      };
      ykAuthorteachercourse(this.qs(msg))
        .then(res => {
          this.listarry = res.data.YkGoods;
        })
        .catch(e => {});
    },
    xkdetail(id) {
      this.$router.push({
        name: "xuankeDetail",
        params: {
          id: id
        }
      });
      document.body.scrollTop = 0;
      document.documentElement.scrollTop = 0;
    },
    see_audio(Aid) {
      this.vedio = Aid;
      this.dialogVisible = true;
    }
  },
  components: { Appheader, Appfooter }
};
</script>

<style scoped>
.guwenDetail {
  width: 1200px;
  margin: 0 auto;
  margin-top: 50px;
  margin-bottom: 46px;
  background: #363640;
  padding:33px;
  box-sizing: border-box;
}
.line {
  width: 4px;
  height: 23px;
  background: rgba(216, 20, 23, 1);
  display: none;
}
.guwen_D_a > div {
  font-size: 24px;
  font-weight: 500;
  color: #c8a94f;
  margin-left: 6px;
}
.guwen_D_b {
  margin-top: 11px;
  padding-top: 14px;
  display: flex;
}
.guwen_D_b > img {
  width: 405px;
  height: 546px;
  margin-right: 35px;
  border-radius: 20px;
}
.guwenD_detail_a {
  margin-top: 15px;
  font-size: 24px;
  font-weight: bold;
  color: #fff;
}
.guwenD_detail_b {
  margin-top: 8px;
  font-size: 18px;
  font-weight: 500;
  color: #a9abb7;
}
.guwenD_detail_c {
  margin-top: 7px;
  flex:1;
  font-size: 14px;
  font-weight: 400;
  color: #a9abb7;
  line-height: 27px;
}
/*  */
.classfy_a {
  /* padding-top: 21px; */
  width: 1200px;
  margin: 0 auto;
}
.a_top {
  justify-content: space-between;
  padding-left: 13px;
  padding-right: 10px;
  margin-bottom: 21px;
}
.line {
  width: 4px;
  height: 23px;
  margin-right: 6px;
}
.left_line {
  font-size: 24px;
  color: #c8a94f;
  font-weight: 500;
}
.b_bottom li {
  width: 288px;
  height: 289px;
  margin-bottom: 16px;
  margin-right: 15px;
  box-sizing: border-box;
  cursor: pointer;
}
.b_bottom li:nth-child(4n) {
  margin-right: 0px;
}
.b_bottom li > img {
  width: 100%;
  height: 200px;
  border-radius: 20px;
}
.b_bottom > li:hover {
}
.b_bottom_a {
  width: 268px;
  margin: 0 auto;
  font-size: 16px;
  color: #c0c1c6;
  margin-top: 15px;
  margin-bottom: 15px;
  text-align: center;
}
.b_bottom_b {
  justify-content: center;
}
.b_bottom_b > div {
  font-size: 14px;
}
.b_bottom_b > div:first-child {
  color: #ff0000;
  margin-right: 5px;
}
.b_bottom_b > div:last-child {
  color: #999;
  text-decoration: line-through;
}
.b_bottom_c {
  width: 268px;
  height: 36px;
  border: 1px solid #444750;
  margin: 0 auto;
  justify-content: center;
  margin-top: 7px;
  color: #7e808d;
  font-size: 14px;
  border-radius: 36px;
}
.b_bottom_c > img {
  width: 14px;
  height: 12px;
  margin-right: 4px;
}
.b_bottom {
  display: flex;
  flex-wrap: wrap;
}
.b_bottom {
  /* padding-left:51px;
  padding-right:51px; */
}
video {
  width: 750px;
  margin: 0 auto;
}
.model_video {
  font-size: 28px;
  color: #333;
  text-align: center;
}
</style>
